import copy

# 新拷贝第一层是不可变类型，第二层是可变类型，这时候在对第一层进行深拷贝，也会开辟新空间进行保存吗？
def demo_深拷贝可变类型():
    a = [1, 2, 3]
    b = [11, 22, 33]
    c = [6, 7, a, b]

    # 测试1， id(c)和id(d)
    d = copy.deepcopy(b)
    print("id(b)->", id(c))
    print("id(d)->", id(d))

def demo_深拷贝不可变类型():
    a = (1, 2, 3)
    b = (11, 22, 33)
    b_1 = [11, 22, 33]
    c = (6, 7, a, b, b_1)

    d = copy.deepcopy(c)
    print("id(c)->", id(c))
    print("id(d)->", id(d))
    print("id(c[2])->", id(c[2]))
    print("id(d[2])->", id(d[2]))

demo_深拷贝不可变类型()
